<style>
.radbtn{
width:20px;
margin-top:10px;
width:5% !important;
}
</style>
<div class="main-content">
	<div class="left-panel"></div>
	<div class="panel">
		<?php echo $this->
		element("backend/left_menu");?>
		<div class="content">
			<div class="title">
				<br />
				<h2 class="t1">
					<?php echo __("Edit DataParam");?></h2>
			</div>
			<div class="categories form">
				<?php echo $this->Form->create('DataParam',array('type'=>'file')); ?>
				<fieldset>
					<div class="input-content">
						<?php  echo $this->Form->input('id', array('type' => 'hidden')); ?>
						<div class="input ">
							<label for="question">
								SDO
								<span>*</span>
							</label>
							<?php echo $this->Form->input('sdo', array('label'=>false,'div'=>false, 'selected'=>'')); 
							?>
							<div class="error-message" id="categoryError"></div>
						</div>
						<div class="input ">
							<label for="question">
								tariff
								<span>*</span>
							</label>
							<?php echo $this->Form->input('tariff', array('label'=>false,'div'=>false)); ?>
							<div class="error-message" id="languageError"></div>
						</div>
						<div class="input ">
							<label for="question">
								account_id
								<span>*</span>
							</label>
							<?php echo $this->Form->input('account_id',array('type'=>'text','label'=>false,'div'=>false, 'selected'=>''));?>
							<div class="error-message" id="questionError"></div>
						</div>
						<div class="input ">
							<label for="link_image">
								rr_no
							</label>
                                                        <?php echo $this-> Form->input('rr_no',array('class'=>'placeholder','placeholder'=>' Link','label'=>false,'div'=>false));?>
                                                        <div class="error-message" id="linkImageError"></div>
                                                         
						</div>
						<div class="input ">
							<label for="external_link">
								regd_consumer_name
								<span>*</span>
							</label>
							<?php echo $this->Form->input('regd_consumer_name',array('class'=>'placeholder','placeholder'=>'External Link(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="externalLinkError"></div>
						</div>
						<div class="input ">
							<label for="answer_1">
								address
								<span>*</span>
							</label>
							<?php echo $this->Form->input('address',array('class'=>'placeholder','placeholder'=>'Answer 1(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answer1Error"></div>
						</div>
						<div class="input ">
							<label for="answer_2">
								landmark
								<span>*</span>
							</label>
							<?php echo $this->Form->input('landmark',array('class'=>'placeholder','placeholder'=>'Answer 2(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answer2Error"></div>
						</div>
						<div class="input ">
							<label for="answer_3">
								area
								<span>*</span>
							</label>
							<?php echo $this->Form->input('area',array('class'=>'placeholder','placeholder'=>'Answer 3(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answer3Error"></div>
						</div>
						<div class="input ">
							<label for="answer_4">
								kw
								<span>*</span>
							</label>
							<?php echo $this->Form->input('kw',array('class'=>'placeholder','placeholder'=>'Answer 4(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answer4Error"></div>
						</div>
						<div class="input ">
							<label for="Clue">
								hp
								<span>*</span>
							</label>
							<?php echo $this->Form->input('hp',array('class'=>'placeholder','placeholder'=>'Clue(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="clueError"></div>
						</div>
						<div class="input ">
							<label for="answer_true">
								kva
								<span>*</span>
							</label>
							<?php echo $this->Form->input('kva',array('class'=>'placeholder','placeholder'=>'Answer True(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answerTrueError"></div>
						</div>
                                            
                                                <div class="input ">
							<label for="answer_true">
								total_load_in_kw
								<span>*</span>
							</label>
							<?php echo $this->Form->input('total_load_in_kw',array('class'=>'placeholder','placeholder'=>'Answer True(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answerTrueError"></div>
						</div>
                                            
                                               <div class="input ">
							<label for="answer_true">
								constant
								<span>*</span>
							</label>
							<?php echo $this->Form->input('constant',array('class'=>'placeholder','placeholder'=>'Answer True(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answerTrueError"></div>
						</div>
                                            
                                               <div class="input ">
							<label for="answer_true">
								date_of-server
								<span>*</span>
							</label>
							<?php echo $this->Form->input('date_of-server',array('class'=>'placeholder','placeholder'=>'Answer True(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answerTrueError"></div>
						</div>
                                            
                                               <div class="input ">
							<label for="answer_true">
								status
								<span>*</span>
							</label>
							<?php echo $this->Form->input('status',array('class'=>'placeholder','placeholder'=>'Answer True(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answerTrueError"></div>
						</div>
                                            
                                               <div class="input ">
							<label for="answer_true">
								station_name
								<span>*</span>
							</label>
							<?php echo $this->Form->input('station_name',array('class'=>'placeholder','placeholder'=>'Answer True(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answerTrueError"></div>
						</div>
                                                 <div class="input ">
							<label for="answer_true">
								dtc_id
								<span>*</span>
							</label>
							<?php echo $this->Form->input('dtc_id',array('type'=>'text','class'=>'placeholder','placeholder'=>'Answer True(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answerTrueError"></div>
						</div>
                                                 <div class="input ">
							<label for="answer_true">
								dtc_name
								<span>*</span>
							</label>
							<?php echo $this->Form->input('dtc_name',array('class'=>'placeholder','placeholder'=>'Answer True(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answerTrueError"></div>
						</div>
                                                 <div class="input ">
							<label for="answer_true">
								pole_id
								<span>*</span>
							</label>
							<?php echo $this->Form->input('pole_id',array('type'=>'text','class'=>'placeholder','placeholder'=>'Answer True(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answerTrueError"></div>
						</div>
                                                 <div class="input ">
							<label for="answer_true">
								section
								<span>*</span>
							</label>
							<?php echo $this->Form->input('section',array('class'=>'placeholder','placeholder'=>'Answer True(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answerTrueError"></div>
						</div>
                                             
                                              <div class="input ">
							<label for="answer_true">
								mr_code
								<span>*</span>
							</label>
							<?php echo $this->Form->input('mr_code',array('class'=>'placeholder','placeholder'=>'Answer True(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answerTrueError"></div>
						</div>
                                              <div class="input ">
							<label for="answer_true">
								mr_day
								<span>*</span>
							</label>
							<?php echo $this->Form->input('mr_day',array('class'=>'placeholder','placeholder'=>'Answer True(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answerTrueError"></div>
						</div>
                                              <div class="input ">
							<label for="answer_true">
								spot_folio
								<span>*</span>
							</label>
							<?php echo $this->Form->input('spot_folio',array('class'=>'placeholder','placeholder'=>'Answer True(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answerTrueError"></div>
						</div>
                                             <div class="input ">
							<label for="answer_true">
								deposits_held_
								<span>*</span>
							</label>
							<?php echo $this->Form->input('deposits_held_',array('class'=>'placeholder','placeholder'=>'Answer True(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answerTrueError"></div>
						</div>
                                            <div class="input ">
							<label for="answer_true">
								credit_debit
								<span>*</span>
							</label>
							<?php echo $this->Form->input('credit_debit',array('class'=>'placeholder','placeholder'=>'Answer True(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answerTrueError"></div>
						</div>
                                            <div class="input ">
							<label for="answer_true">
								bbc
								<span>*</span>
							</label>
							<?php echo $this->Form->input('bbc',array('class'=>'placeholder','placeholder'=>'Answer True(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answerTrueError"></div>
						</div>
                                            <div class="input ">
							<label for="answer_true">
								asc
								<span>*</span>
							</label>
							<?php echo $this->Form->input('asc',array('class'=>'placeholder','placeholder'=>'Answer True(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answerTrueError"></div>
						</div>
                                              <div class="input ">
							<label for="answer_true">
								other_debits
								<span>*</span>
							</label>
							<?php echo $this->Form->input('other_debits',array('class'=>'placeholder','placeholder'=>'Answer True(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="answerTrueError"></div>
						</div>
                                            
						<!--<div class="input ">
							<label for="id_user_login">
								Id User Login
								<span>*</span>
							</label>
							<?php echo $this->Form->input('id_user_login',array('class'=>'placeholder','placeholder'=>'Id User Login(*)','label'=>false,'div'=>false));?>
							<div class="error-message" id="idUserLoginError"></div>
						</div>-->
						<div class="input ">
							<label for="id_user_login">
								Active
								<span>*</span>
							</label>
							<?php
                    			echo $this->Form->input('active', array(
                                      'type' => 'select',
                                      'options' => array('0'=>'Unactive', '1'=>'Active'),
                                      'label'=>false,
                                      'div'=>false,
                                      
                                      
                                      
                                  )
                    ); ?>
						</div>

					</div>

					<div class="submit">
						<?php echo $this->
						Form->submit("",array('class'=>'save','id'=>'btnSave')); ?>
						<a href="javascript:resetForm()" id="resetForm" class="reset">Reset</a>
					</div>
				</fieldset>
			</div>
			<br />
		</div>
	</div>
	<div class="right-panel"></div>
	<!-- main.end -->
</div>
<script>
    function readURL(input) {
            if (input.files && input.files[0]) {
                var reader = new FileReader();

                reader.onload = function (e) {
                    $('#image_show')
                        .attr('src', e.target.result)
                        .width(200)
                    .height(200);
                };

              reader.readAsDataURL(input.files[0]);
            }
     }
    $("#btnSave").click(function(){
        var  validateDataParam   = new validate("DataParamDataParam","questionError","This field is not empty.");
        var  validateAnswer1   = new validate("DataParamAnswer1","answer1Error","This field is not empty.");
        var  validateAnswer2   = new validate("DataParamAnswer2","answer2Error","This field is not empty.");
        var  validateAnswer3   = new validate("DataParamAnswer3","answer3Error","This field is not empty.");
        var  validateAnswer4   = new validate("DataParamAnswer4","answer4Error","This field is not empty.");
        var  validateAnswerTrue   = new validate("DataParamAnswerTrue","answerTrueError","This field is not empty.");

        var result1 = validateDataParam.notEmpty();
        var result2 = validateAnswer1.notEmpty();
        var result3 = validateAnswer2.notEmpty();
        var result4 = validateAnswer3.notEmpty();
        var result5 = validateAnswer4.notEmpty();
        var result6 = validateAnswerTrue.notEmpty();
        var result7 = true;
        var linkExtent = $("#DataParamExternalLink").val();
       
        if(linkExtent && !linkExtent.match(/https:\/\/(?:www\.)?youtube.com/))
        {
            result7=false;
            $("#externalLinkError").html("Please input link youtube video");
        }
        else{
             $("#externalLinkError").html("");
        }
        return result1 && result2 && result3 && result4 && result5 && result6 && result7;
    });
	function resetForm()
	{
		window.location.reload();
	}
</script>